package demo.util;

/**
 * 断言工具
 * 
 * @author wangbin
 * 
 */
public class AssertUtils {

	/**
	 * 断言不空
	 * 
	 * @param obj
	 * @param errorMsg
	 */
	public static void notNull(Object obj, String errorMsg) {
		if (obj == null) {
			throw new RuntimeException(errorMsg);
		}
	}

	/**
	 * 断言为真
	 * 
	 * @param condition
	 * @param errorMsg
	 */
	public static void isTrue(boolean condition, String errorMsg) {
		if (!condition) {
			throw new RuntimeException(errorMsg);
		}
	}
}
